package org.seamon.management.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @author Simon
 */
@Configuration
public class RabbitConfig {

    public static final String SMS_BATCH_QUEUE = "sms.batch.queue";
    public static final String SMS_EXCHANGE = "sms.exchange";
    public static final String SMS_ROUTING_KEY = "sms";

    @Bean
    public Queue smsQueue() {
        return new Queue(SMS_BATCH_QUEUE);
    }

    @Bean
    public DirectExchange smsExchange() {
        return new DirectExchange(SMS_EXCHANGE);
    }

    @Bean
    public Binding bindingSms(DirectExchange smsExchange, Queue smsQueue) {
        return BindingBuilder.bind(smsQueue).to(smsExchange).with(SMS_ROUTING_KEY);
    }

}
